package models;

import java.sql.ResultSet;
import java.sql.SQLException;

public class 
ReturnTransactionModel 
extends AbstractModel
{	public boolean	insert(Integer receipt_id, String name)
	{	
		try{
			ps = con.prepareStatement("INSERT INTO ReturnTransaction VALUES (returnId_counter.nextval,sysdate,?,?)");
			ps.setInt(1, receipt_id);
			ps.setString(2, name);
			return wrapUp();
		} 
		catch(SQLException ex)
		{ 
			return registerException(ex); 
		}
	}
	
	public boolean	delete(Integer retid)
	{ 	
		try
		{
			ps = con.prepareStatement("DELETE FROM ReturnTransaction WHERE retid = ? ");
			ps.setInt(1,retid);
			return wrapUp();
		} 
		catch(SQLException ex)
		{ 
			return registerException(ex); 
		}
	}
	
	public ResultSet show()
	{ 
		return super.show("ReturnTransaction"); 
	}
}
